<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>测试接口</title>
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/aes.js" type="text/javascript"></script>
<script src="js/api.js" type="text/javascript"></script>
<script src="js/bootstrap.min.js" type="text/javascript"></script>
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="to_json_files/font-awesome.min.css" rel="stylesheet">
<link href="to_json_files/base.css" rel="stylesheet">
<style type="text/css">
    body{width: 100%;font-family: '微软雅黑';}
    #showJson{
    	text-align: left;
    }
</style>
<script src="js/test.js" type="text/javascript"></script>
</head>
<body>
<div style="padding: 10px;" id="menuDiv"></div>
<div class="col-sm-9 col-md-10 main text-center">
    <p class="visible-xs">
        <button type="button" class="btn btn-primary btn-xs"
            data-toggle="offcanvas">
            <i class="glyphicon glyphicon-chevron-left"></i>
        </button>
    </p>
    <br>
    <form action="https://www.baidu.com/s" method="get" target="_blank">
		<input class="form-control" name="wd" type="text" placeholder="百度一下" style="width: 300px;float: left;margin-left: 20px;" />
		<input type="submit" value="百度一下" class="btn" style="width: 100px;float: left;border: 1px solid #ccc;margin-left: 5px;">
	</form>
	<br>
	
		<input class="form-control" id="baseUrl" type="text" placeholder="接口BaseUrl" value="http://localhost:8080" style="margin: 20px;" />
		<div class="table-responsive">
        <form class="form-horizontal" role="form"
            action="" method="post" enctype="multipart/form-data" onsubmit="return false;">
            <fieldset>
            	<div class="form-group">
                    <label class="col-sm-2 control-label" id="userName"></label>
                    <div class="col-sm-5">
                        <input type="button" id="login" value="登录" class="col-sm-2 btn btn-success">
                        <input type="button" id="logout" value="退出" class="col-sm-2 btn btn-danger" style='display:none;'>
                    </div>
                    <div class="col-sm-2">
	            		<input class="form-control" id="phoneInput" type="text" placeholder="手机号" value="13732545670" />
		            </div>
		            <div class="col-sm-2">
		            	<input class="form-control" id="passwordInput" type="text" placeholder="密码" value="a123456" />
		            </div>
                </div>
            </fieldset>
            <fieldset>
                <div class="form-group">
                    <label class="col-sm-2 control-label">接口选项</label>
                    <div class="col-sm-5">
                        <select id="interfaceSelect" class="form-control">
<!-- ## 1 分割线#############################################################################-->
<option method='post' url='/api/account/user/rst-pwd-by-sms' value='{"phone":"13732545670","password":"aa123456","smsCode":"123456"}'>1.6. 手机号修改密码</option>
<option method='post' url='/api/account/user/send-rst-pwd-email' value='{"email":"xxx@qq.com"}'>1.8. 发送"修改密码请求"邮件</option>
<option method='post' url='/api/account/user/rst-pwd-by-email' value='{"email":"xxx@qq.com","password":"123456","eTag":"xxx"}'>1.7. 邮箱修改密码</option>
<option method='post' url='/api/account/user/phone/13333333333' value='{}'>1.10. 判断手机号是否存在</option>
<option method='post' url='/api/account/user/token/xxxxxxx' value='{}'>1.11. 判断token是否有效</option>
<option method='post' url='/api/account/email/check' value='{"email":"xxx@qq.com","eTag":"xxxxxxx"}'>1.12. 验证邮箱</option>
<option method='' url='' value='{}'>##################################</option>


<!-- ## 2 分割线#############################################################################-->
<option method='post' url='/api/account/user/son' value='{"userName":"zhangsan","phone":"13333333333","email":"xxx@qq.com"}'>2.1. 添加子账号</option>
<option method='get' url='/api/account/user/last-upd' value='{"property":"password"}'>2.2. 根据用户属性获取最后一次修改时间</option>
<option method='put' url='/api/account/user/photo' value='{"photo":"http://xx.jpg","eTag":"tag"}'>2.3. 修改用户头像</option>
<option method='post' url='/api/account/user/email/send-son-reset-pwd' value='{"email":"85263420@qq.com"}'>2.4. 管理员发送(邀请)激活邮件</option>
<option method='get' url='/api/account/user-me' value='{}'>2.6. 获取当前登录用户</option>
<option method='post' url='/api/account/captcha/sms-upd-phone' value='{"phone":"13732545670"}'>2.14. 发送修改手机号短信验证码</option>
<option method='put' url='/api/account/user/phone' value='{"smsCode":"123456","phone":"13732545670","eTag":"tag"}'>2.5. 修改用户手机号</option>
<option method='put' url='/api/account/user/password' value='{"oldPassword":"a123456","password":"aa123456","eTag":"tag"}'>2.7. 修改登录密码</option>
<option method='put' url='/api/account/user/username' value='{"userName":"newname","eTag":"tag"}'>2.8. 修改用户名</option>
<option method='put' url='/api/account/user/email' value='{"email":"123@qq.com","eTag":"tag"}'>2.9. 修改Email</option>
<option method='get' url='/api/account/user/1' value='{}'>2.10. 根据用户编号获取用户信息</option>
<option method='get' url='/api/account/user/phone/13732545670' value='{}'>2.11. 根据用户手机号获取用户信息</option>
<option method='delete' url='/api/account/user/son?userId=11' value='{}'>2.12. 删除子账号</option>
<option method='post' url='/api/account/email/send-check' value='{}'>2.15. 发送"验证邮箱"邮件</option>
<option method='put' url='/api/account/user/son/status' value='{"userId":1,"status":2,"eTag":"xxx"}'>2.16. 修改子账号状态(启用|禁用)</option>
<option method='put' url='/api/account/user/son' value='{"userId":1,"userName":"zhangsan","phone":"13333333333","email":"xxx@qq.com","eTag":"xxx"}'>2.17. 编辑子账号</option>


<!-- ##分割线#############################################################################-->
<option method='' url='' value='{}'>##################################</option>
<option method='get' url='/api/notice/new' value='{}'>15.1. 获取未读通知数量</option>
<option method='post' url='/api/notice/list' value='{"readed":false}'>15.2. 获取通知列表</option>
<option method='get' url='/api/notice/{noticeId}/detail' value='{}'>15.3. 获取通知详情</option>
<option method='put' url='/api/notice/all/read' value='{}'>15.4. 将所有通知设为已读</option>
<option method='delete' url='/api/notice/deleted' value='{"noticeId":1}'>15.5. 删除通知</option>

<!-- ##分割线#############################################################################-->
<option method='' url='' value='{}'>##################################</option>
<option method='post' url='/api/material/out/rent' value='{"employeeId":44,"materialCode":"xxx","outPrice":188.88,"outTime":1491321600000}'>新增出租</option>
<option method='put' url='/api/material/out/rent' value='{"id":1,"outTime":1491321600000,"outPrice":198.88}'>修改出租</option>
<option method='delete' url='/api/material/out/rent' value='{"id":1}'>删除出租</option>
<option method='get' url='/api/material/out/rent/1' value='{}'>获取单个出租记录</option>
<option method='post' url='/api/material/out/rent/list' value='{"pageNum":1}'>获取出租列表</option>
<option method='xxx' url='' value='{}'>=============================</option>
<option method='post' url='/api/material/out/installment' value='{"employeeId":44,"materialCode":"xxx","outTime":1491321600000,"countTimes":12}'>新增分期</option>
<option method='put' url='/api/material/out/installment' value='{"id":1,"outTime":1491321600000,"countTimes":6}'>修改分期</option>
<option method='delete' url='/api/material/out/installment' value='{"id":1}'>删除分期</option>
<option method='get' url='/api/material/out/installment/1' value='{}'>获取单个分期记录</option>
<option method='post' url='/api/material/out/installment/list' value='{"pageNum":1}'>获取分期列表</option>
<option method='post' url='/api/material/out/installment/repay' value='{"id":1}'>提前还款</option>
<option method='post' url='/api/material/out/installment/repeal' value='{"id":1}'>撤销提前还款</option>
<option method='xxx' url='' value='{}'>=============================</option>
<option method='post' url='/api/material/out/receive' value='{"employeeId":44,"materialCode":"xxx","outTime":1491321600000}'>新增领用</option>
<option method='put' url='/api/material/out/receive' value='{"id":1,"outTime":1491321600000}'>修改领用</option>
<option method='delete' url='/api/material/out/receive' value='{"id":1}'>删除领用</option>
<option method='get' url='/api/material/out/receive/1' value='{}'>获取单个领用记录</option>
<option method='post' url='/api/material/out/receive/list' value='{"pageNum":1}'>获取领用列表</option>
<option method='xxx' url='' value='{}'>=============================</option>
<option method='post' url='/api/material/out/sell' value='{"employeeId":44,"materialCode":"xxx","outTime":1491321600000}'>新增出售</option>
<option method='put' url='/api/material/out/sell' value='{"id":1,"outTime":1491321600000}'>修改出售</option>
<option method='delete' url='/api/material/out/sell' value='{"id":1}'>删除出售</option>
<option method='get' url='/api/material/out/sell/1' value='{}'>获取单个出售记录</option>
<option method='post' url='/api/material/out/sell/list' value='{"pageNum":1}'>获取出售列表</option>
<option method='xxx' url='' value='{}'>=============================</option>
<option method='get' url='/api/material/out/employee/44' value='{}'> 获取员工的个人物资列表（出租和领用）的物品</option>
<option method='put' url='/api/material/out/transfer' value='{"id":1,"siteId":1,"etag":"xx"}'> 物资分仓</option>
<option method='get' url='/api/material/out/excel' value='{"type":1}'> 出库列表导出到excel</option>

<option method='' url='' value='{}'>##################################</option>
<option method='post' url='/api/operation/taker/order/list' value='{"pageNum":1}'>获取运单列表</option>

<!-- ##分割线#############################################################################-->
                        </select>
                    </div>
                </div>
            </fieldset>
            <fieldset>
                <div class="form-group">
                    <label class="col-sm-2 control-label">请求方法</label>
                    <div class="col-sm-2">
                        <input class="form-control" id="api_method" type="text"
                            placeholder="" value="" />
                            <div style="float: left;">
                            <span>返回文件</span><input id="returnFileCheckbox" type="checkbox" value="" />
                            <a id="loadFileA" target="_blank" href="javascript:void(0)" style="display:none;"></a>
                        </div>
                    </div>
                </div>
            </fieldset>
            <fieldset>
                <div class="form-group">
                    <label class="col-sm-2 control-label">接口地址</label>
                    <div class="col-sm-8">
                        <input class="form-control" id="api_url" type="text"
                            placeholder="" value="" />
                    </div>
                </div>
            </fieldset>

            <fieldset>
                <div class="form-group">
                    <label class="col-sm-2 control-label">请求参数</label>
                    <div class="col-sm-8">
                        <textarea class="form-control" id="api_param" rows="6"></textarea>
                    </div>
                </div>
            </fieldset>
            
            
            <fieldset>
                <div class="form-group">
                    <label class="col-sm-2 control-label"></label>
                    <div class="col-sm-5">
                        <input type="button" id="test" class="col-sm-3 btn btn-primary" value="测试">
                    </div>
                </div>
			</fieldset>
            	
            <fieldset>
                <div class="form-group">
                    <label class="col-sm-2 control-label">返回状态</label>
                    <div class="col-sm-2">
                        <input class="form-control" id="api_status" type="text"
                            placeholder="" value="" />
                    </div>
                </div>
            </fieldset>
				<fieldset id="showJson">
					<div class="form-group">
						<label class="col-sm-2 control-label">返回信息</label>
						<div class="col-sm-8">
								<div
									style="padding: 10px; font-size: 16px; border-bottom: solid 1px #ddd;"
									class="navi">
									<a href="#" class="tip zip" title="压缩"  data-placement="bottom"><i class="fa fa-database"></i></a>
									<a href="#" class="tip clear" title="" data-placement="bottom" data-original-title="清空"><i class="fa fa-trash"></i></a>
								</div>
								<div id="right-box"
									style="height: 1000px; border: solid 1px #ddd; resize: none; overflow-y: scroll; outline: none; position: relative;">
									<div id="line-num"
										style="background-color: #fafafa; padding: 0px 8px; float: left; border-right: dashed 1px #eee; display: none; z-index: -1; color: #999; position: absolute; text-align: center; over-flow: hidden;">
										<div>
											1
											<div></div>
										</div>
									</div>
									<div class="ro" id="json-target" style="padding: 0px 25px;">
										<span style="color: #f1592a; font-weight: bold;">RangeError:
											Invalid array length</span>
									</div>
								</div>
								<form id="form-save" method="POST">
									<input type="hidden" value="" id="txt-content" name="content">
								</form>
						</div>
					</div>
				</fieldset>

				<fieldset>
					<div class="form-group">
						<main class="row-fluid"> <textarea id="json-src"
							style="display: none;"></textarea> <br style="clear: both;">
						</main>
					</div>
				</fieldset>
			</form>
    </div>

</div>

<!-- ======================Json=============== -->
<link href="to_json_files/jquery.numberedtextarea.css" rel="stylesheet">
<script src="to_json_files/hm.js"></script></script><script src="to_json_files/jquery.min.js"></script>
<script src="to_json_files/jquery.message.js"></script><div style="clear:both;"></div><div id="jquery-beauty-msg"></div>
<script src="to_json_files/jquery.json.js"></script>
<script src="to_json_files/jquery.xml2json.js"></script>
<script src="to_json_files/jquery.json2xml.js"></script>
<script src="to_json_files/json2.js"></script>
<script src="to_json_files/jsonlint.js"></script>
<script src="to_json_files/bootstrap.min.js"></script>
<script src="to_json_files/jquery.numberedtextarea.js"></script>
<script type="text/javascript">
$('textarea').numberedtextarea();
var current_json = '';
var current_json_str = '';
var xml_flag = false;
var zip_flag = false;
var shown_flag = false;
$('.tip').tooltip();
function init(){
    xml_flag = false;
    zip_flag = false;
    shown_flag = false;
    renderLine();
    $('.xml').attr('style','color:#999;');
    $('.zip').attr('style','color:#999;');

}
$('#json-src').keyup(function(){
    init();
    var content = $.trim($(this).val());
    var result = '';
    if (content!='') {
        //如果是xml,那么转换为json
        if (content.substr(0,1) === '<' && content.substr(-1,1) === '>') {
            try{
                var json_obj = $.xml2json(content);
                content = JSON.stringify(json_obj);
            }catch(e){
                result = '解析错误：<span style="color: #f1592a;font-weight:bold;">' + e.message + '</span>';
                current_json_str = result;
                $('#json-target').html(result);
                return false;
            }

        }
        try{
            current_json = jsonlint.parse(content);
            current_json_str = JSON.stringify(current_json);
            //current_json = JSON.parse(content);
            result = new JSONFormat(content,4).toString();
        }catch(e){
            result = '<span style="color: #f1592a;font-weight:bold;">' + e + '</span>';
            current_json_str = result;
        }

        $('#json-target').html(result);
    }else{
        $('#json-target').html('');
    }

});
$('.xml').click(function(){
    if (xml_flag) {
        $('#json-src').keyup();
    }else{
        var result = $.json2xml(current_json);
        $('#json-target').html('<textarea style="width:100%;height:100%;border:0;resize:none;">'+result+'</textarea>');
        xml_flag = true;
        $(this).attr('style','color:#15b374;');
    }

});

function renderLine(){
    var line_num = $('#json-target').height()/20;
    $('#line-num').html("");
    var line_num_html = "";
    for (var i = 1; i < line_num+1; i++) {
        line_num_html += "<div>"+i+"<div>";
    }
    $('#line-num').html(line_num_html);
}
$('.zip').click(function(){
    if (zip_flag) {
        $('#json-src').keyup();
    }else{
        $('#json-target').html(current_json_str);
        zip_flag = true;
        $(this).attr('style','color:#15b374;');
    }

});
$('.clear').click(function(){
     $('#json-src').val('');
     $('#json-target').html('');
});
$('.save').click(function(){
    var content = JSON.stringify(current_json);
    $('#txt-content').val(content);
    $("#form-save").submit();
});
$('#json-src').keyup();

</script>
</body>
</html>